package com.weiqiao.mall.repository.impl;


import com.mongodb.client.MongoCollection;
import com.weiqiao.base.dao.impl.BaseMongoDaoImpl;
import com.weiqiao.mall.repository.IBankRepository;
import org.bson.Document;
import org.bson.conversions.Bson;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository("BankRespositoryImpl")
public class BankRespositoryImpl extends BaseMongoDaoImpl implements IBankRepository {

    private final static String collectionName = "bank_";

    @Override
    public List<String> hotBankList(Bson filter, Bson sort, int skip, int limit, int company_id){
        return super.findFilterSortSkipLimit(collectionName + company_id,filter,sort,skip,limit);
    }

    @Override
    public List<String> getAll(int company_id, Bson filter) {
        return super.findFilter(collectionName + company_id,filter);
    }

    @Override
    public Boolean updateBank(Bson filter, Document doc, int company_id){
        return  super.updateOne(collectionName + company_id,filter,doc,false);
    }

    @Override
    public Boolean insertBank(String json, int company_id){
        return super.inSert(collectionName + company_id,json);
    }

    @Override
    public Boolean deleteBank(Bson filter,Document doc, int company_id){
        return super.updateOne(collectionName + company_id,filter,doc,false);
    }

    @Override
    public int countBank( int company_id,Bson filters){
       return super.statististics(collectionName + company_id,filters);
    }

    @Override
    public String getBankInfo(int company_id, Bson filters) {
        return super.findOne(collectionName + company_id,filters);
    }
}
